<!--
 * @FilePath     : /study_code/vue2.x/transiton-prop-is.html
 * @Description  : transition is 属性，设置多个组件的过渡
 * @Date         : 2025-05-03 08:25:35
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-05-03 08:25:35
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <style>
      .component-fade-enter-active,
      .component-fade-leave-active {
        transition: opacity 0.3s ease;
      }
      .component-fade-enter, .component-fade-leave-to
      /* .component-fade-leave-active for below version 2.1.8 */ {
        opacity: 0;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <button @click="view == ca ? view = cb : view = ca">切换组件</button>
      <transition name="component-fade" mode="out-in">
        <component v-bind:is="view"></component>
      </transition>
    </div>
    <script src="/vue/dist/vue.min.js"></script>
    <script src="./common.js"></script>
    <script>
      const ca = {
        template: '<div>Component A</div>',
      }
      const cb = {
        template: '<div>Component B</div>',
      }

      new Vue({
        el: '#app',
        data: {
          view: ca,
        },
        components: {
          ca,
          cb,
        },
      })
    </script>
  </body>
</html>
